.github/workflows/generate-books.yml

name: generate-books
on:
  push:
    branches:
      - master
jobs:
  generate-books:
    name: generate-books
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: jdx/mise-action@v2
        with:
          version: 2025.6.1 # [default: latest] mise version to install
          install: true # [default: true] run `mise install`
          cache: true # [default: true] cache mise using GitHub's cache
          experimental: true # [default: false] enable experimental features
          # automatically write this mise.toml file
      #          mise.toml: |
      #            [tools]
      #            java = "24"
      #            node = "10"
      - run: npm install -g gitbook-cli
      - run: gitbook install
      - run: wget https://github.com/huxiaoning/gitbook-helper/releases/download/1.0/gitbook-helper-1.0-SNAPSHOT.jar
      - run: java -jar -Dwork.dir=$(pwd) gitbook-helper-1.0-SNAPSHOT.jar
      - run: rm -rf gitbook-helper-1.0-SNAPSHOT.jar
      - run: gitbook build
      - run: mv _book ../output
      - name: 删除除 [.,..] 外的所有文件(夹)
        run: ls -a | grep -v '^.$' | grep -v '^..$' | xargs -t -I % rm -rf %
      - uses: actions/checkout@v4
        with:
          ref: books
      - name: 删除除 [.git,.,..] 外的所有文件(夹)
        run: ls -a | grep -v '^.git$' | grep -v '^.$' | grep -v '^..$' | xargs -t -I % rm -rf %
      - run: cp -r ../output/* .
      - run: git config --global user.email "robot@github.com"
      - run: git config --global user.name "robot"
      - run: git add .
      - run: git commit -m 'UP'
      - run: git push

results matching ""

    No results matching ""